//	Copyright (c) 2009 App Aware
//
//	Permission is hereby granted, free of charge, to any person obtaining a copy of this software
//	and associated documentation files (the "Software"), to deal in the Software without restriction,
//	including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
//	and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
//	subject to the following conditions:
//
//	The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
//	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
//	INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
//	BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
//	TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import "ClassDevelopmentAppDelegate.h"
#import "UIImageCategories.h"
#import "NSArrayCategories.h"
#import "NSStringEmpty.h"
#import "UIColorCategories.h"

#define MPLog() NSLog(@"%@: %s (%i)",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] stringByDeletingPathExtension], _cmd, __LINE__);

@implementation ClassDevelopmentAppDelegate

@synthesize window;


- (void)applicationDidFinishLaunching:(UIApplication *)application {    

	MPLog();
	
	UIImage *myImage = [UIImage imageNamed:@"test.png"];

	UIImage *maskedImage = [myImage maskWithImage:[UIImage imageNamed:@"mask.png"]];
	maskedImage = [maskedImage scaleToSize:CGSizeMake(57, 57)];
	
	UIImage *roundedImage = [myImage maskWithImage:[UIImage imageNamed:@"mask2.png"]];
	roundedImage = [roundedImage scaleToSize:CGSizeMake(57, 57)];
	roundedImage = [roundedImage makeRoundedCornersWithCornerWidth:10 CornerHeight:10];
	
	UIImageView *imageViewMasked = [[UIImageView alloc] initWithImage:maskedImage];
	imageViewMasked.center = CGPointMake(100, 240);
	[window addSubview:imageViewMasked];

	UIImageView *imageViewRounded = [[UIImageView alloc] initWithImage:roundedImage];
	imageViewRounded.center = CGPointMake(200, 240);
	[window addSubview:imageViewRounded];

	NSArray *testArray = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", nil];
	testArray = [testArray shuffle];

	for ( NSUInteger idx = 0; idx < [testArray count]; idx++ ) {
		NSLog(@"Object # %@", [testArray objectAtIndex:idx]);
	}
	
	NSLog(@"Random Object: # %@", [testArray randomObject]);
	
	NSString *testString = @"Test";
	if ([testString isEmpty]) {
		NSLog(@"%@", @"Teststring is empty.");
	}

	UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, 320, 40)];
	label.text = @"This is a test";
	label.textColor = [UIColor randomColor];
	label.font = [UIFont fontWithName:@"Verdana" size:16];
	
	[window addSubview:label];
	
	// Override point for customization after application launch
    [window makeKeyAndVisible];
}


- (void)dealloc {
    [window release];
    [super dealloc];
}


@end
